import type { RouteRecordRaw } from 'vue-router';
import { RouteNames } from '@/routes/names';

export default [
  {
    path: '/user',
    component: () => import('@/layouts/DefaultLayout.vue'),
    meta: { requiresAuth: true },
    children: [
      {
        path: 'profile',
        name: RouteNames.USER_PROFILE,
        component: () => import('@/views/user/Profile.vue'),
        meta: {
          title: '个人中心',
          roles: ['user', 'admin'],
          keepAlive: true,
        },
      },
      {
        path: 'admin',
        name: RouteNames.USER_ADMIN,
        component: () => import('@/views/user/AdminPanel.vue'),
        meta: {
          title: '用户管理',
          roles: ['admin'], // 仅管理员可访问
          icon: 'user-management',
        },
      },
    ],
  },
] as RouteRecordRaw[];
